<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>支付成功</title>
</head>
<body>

<p align="center">支付成功！还有<span id="sp">5</span>秒跳转到主界面...</p>
<script>
    onload = function () {
        setInterval(go, 1000)
    };
    var x = 4;

    function go() {

        if (x >= 0) {
            document.getElementById("sp").innerText = x;
        } else {
            location.href = "/";
        }
        x--;
    }
</script>

</body>
</html>